package com.swt.gap.controller;

import com.swt.gap.model.entity.FileClass;
import com.swt.gap.service.DataResourceClassService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "200 数据资源分类")
@RestController
@RequestMapping("/data-resource-class")
@Slf4j
public class DataResourceClassController {

    private final DataResourceClassService dataResourceClassService;

    public DataResourceClassController(DataResourceClassService dataResourceClassService) {
        this.dataResourceClassService = dataResourceClassService;
    }

    @GetMapping
    @ApiOperation(value = "获取资源分类列表", notes = "获取资源分类列表")
    @ApiImplicitParam(name = "keyword", dataType = "string",paramType = "query", value = "分类名称")
    @ApiResponse(code = 200, message = "获取成果", response = FileClass.class, responseContainer = "List")
    public ResponseEntity<List<FileClass>> listDataResourceClass(@RequestParam(required = false) String keyword){
        return ResponseEntity.ok(dataResourceClassService.listDataResourceClass(keyword));
    }

}